<template>
	<view class="userQrCodeWp">
		<view class="userQrCode">
			<view class="name">
				{{userInfo.name?userInfo.name:''}}
			</view>
			<view class="title">
				{{userInfo.position?userInfo.position:''}}
			</view>
			<view>
				<view class="userQrCodeImg">
					<image class="imgWp" :src="qrCodeImgUrl" alt="个人小程序码" srcset=""></image>
				</view>
				<view class="company">
					{{userInfo.company?userInfo.company:''}}
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	export default {
		data() {
			return {
				qrCodeImgUrl: '',
				userInfo: {}
			};
		},
		onLoad(option) {
			uni.showLoading({

			})
			this.qrCodeImgUrl = JSON.parse(decodeURIComponent(option.qrCodeImgUrl))
			uni.setNavigationBarColor({
				backgroundColor: '#83869c',
				frontColor: '#ffffff'
			})
			if (option.openId) {
				this.queryCurrentCardByOpenId(option.openId)
			}
		},
		onReady() {
			uni.hideLoading()
		},
		methods: {
			//通过openId查询名片信息
			async queryCurrentCardByOpenId(openId) {
				let res = await this.$api.queryCurrentCardByOpenId({
					openId
				})
				if (res.success && res.result.id) {
					this.userInfo = res.result

				}


			},

		},
		onUnload() {
			uni.setNavigationBarColor({
				backgroundColor: '#ffffff',
				frontColor: '#000000'
			})
		}
	}
</script>

<style lang="scss">
	.userQrCodeWp {
		width: 100%;
		height: 100vh;
		background-color: #83869c;
		display: flex;
		justify-content: center;

		.userQrCode {
			margin-top: 85upx;
			width: 80%;

			.name {
				text-align: center;
				color: #fff;
				height: 60upx;
				font-size: 60upx;
				font-weight: 500;
			}

			.title {
				text-align: center;
				color: #fff;
				height: 34upx;
				font-size: 36upx;
				font-weight: 400;
				padding: 40upx 0;
			}

			.userQrCodeImg {
				background: url('https://file.casugn.com/storecompcard/temp/椭圆 2 拷贝@2x_1655178792679.png');
				// background: url('https://file.casugn.com/storecompcard/temp/bg2_1657266111547.png');
				background-size: contain;
				background-repeat: no-repeat;
				margin: 80upx auto;
				width: 480upx;
				height: 480upx;
				display: flex;
				justify-content: center;
				align-items: center;

				// animation: an1 3s  linear  infinite;
				// @keyframes an1 {
				//             to {
				//                 /*变换 transform;旋转 rotate */
				//                 transform: rotate(360deg);
				//             }
				//         }
				.imgWp {
					background-color: #fff;
					margin: 0 auto;
					padding: 20upx;
					height: 300upx;
					width: 300upx;
					border-radius: 50%;

				}
			}

			.companyLogoWp {
				margin: 0 auto;
				padding-top: 40upx;
				height: 110upx;
				width: 110upx;
				display: flex;
				justify-content: center;
				align-items: center;

			}

			.company {
				padding-top: 32upx;
				text-align: center;
				height: 34upx;
				font-size: 36upx;
				font-weight: 400;
				color: #FFFFFF;
			}

		}

	}
</style>